package cc.customer.web.cRound;

import cc.customer.cRound.domain.CRoundConfig;
import cc.customer.cRound.service.CRoundConfigService;
import cc.customer.common.domain.ResponseBo;
import cc.customer.web.sys.controller.base.BaseController;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value = "cRoundConfig")
public class CRoundConfigController extends BaseController {

    @Autowired
    private CRoundConfigService roundConfigService;

    /***保存修改模板*/
    @RequestMapping(value = "editRoundConfig")
    @ResponseBody
    public ResponseBo editRoundGrade(String gCount, String gUuid, String cOrder, String cPid, String cDeptid, String cType, String cUuid){

        if(StringUtils.isEmpty(cPid)){
            return ResponseBo.error("请选择项目");
        }
        CRoundConfig config = new CRoundConfig();
        config.setcOrder(cOrder);
        config.setcDeptid(cDeptid);
        config.setcPid(cPid);
        config.setcType(cType);
        config.setcUuid(cUuid);
        config.setcGradeId(gUuid);
        config.setcCount(gCount);

        try {
            return roundConfigService.editRoundConfig(config);
        }catch (Exception e){
            e.printStackTrace();
            return ResponseBo.error("操作失败");
        }
    }
}
